package com.mc.fil.service.impl;

import java.util.List;

import com.mc.common.core.domain.model.LoginUser;
import com.mc.common.utils.DateUtils;
import com.mc.common.utils.ServletUtils;
import com.mc.framework.web.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mc.fil.mapper.FilProductionRecordsMapper;
import com.mc.fil.domain.FilProductionRecords;
import com.mc.fil.service.IFilProductionRecordsService;

/**
 * 生产信息Service业务层处理
 *
 * @author mc
 * @date 2021-04-12
 */
@Service
public class FilProductionRecordsServiceImpl implements IFilProductionRecordsService
{
    @Autowired
    private FilProductionRecordsMapper filProductionRecordsMapper;
    @Autowired
    private TokenService tokenService;

    /**
     * 查询生产信息
     *
     * @param id 生产信息ID
     * @return 生产信息
     */
    @Override
    public FilProductionRecords selectFilProductionRecordsById(String id)
    {
        return filProductionRecordsMapper.selectFilProductionRecordsById(id);
    }

    /**
     * 查询生产信息列表
     *
     * @param filProductionRecords 生产信息
     * @return 生产信息
     */
    @Override
    public List<FilProductionRecords> selectFilProductionRecordsList(FilProductionRecords filProductionRecords)
    {
        return filProductionRecordsMapper.selectFilProductionRecordsList(filProductionRecords);
    }

    /**
     * 新增生产信息
     *
     * @param filProductionRecords 生产信息
     * @return 结果
     */
    @Override
    public int insertFilProductionRecords(FilProductionRecords filProductionRecords)
    {
        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
        filProductionRecords.setCreatedBy(loginUser.getUsername());
        filProductionRecords.setCreatedTime(DateUtils.getNowDate());
        return filProductionRecordsMapper.insertFilProductionRecords(filProductionRecords);
    }

    /**
     * 修改生产信息
     *
     * @param filProductionRecords 生产信息
     * @return 结果
     */
    @Override
    public int updateFilProductionRecords(FilProductionRecords filProductionRecords)
    {
        return filProductionRecordsMapper.updateFilProductionRecords(filProductionRecords);
    }


}
